package com.google.code.yargon.engine;

import java.util.HashMap;

public class ValueSet {
	
	private HashMap<String, Integer> values;
	private HashMap<String, Integer> advancements;
	
	public ValueSet() {
		values = new HashMap<String, Integer>();
		advancements = new HashMap<String, Integer>();
	}
	
	public int get(String name) {
		if(null != values.get(name)) {
			return values.get(name);
		}
		return 0;
	}
	
	public void set(String name, int value) {
		values.put(name, value);
	}
	
	public void advance(String name, int adv) {
		advancements.put(name, advancements.get(name) + adv);
				
		// If advancement reaches 100, reset it to zero and advance the attribute by one
		if(advancements.get(name) > 100) {
			advancements.put(name, 0);
			values.put(name, values.get(name) + 1);
		}
	}
}
